{template "header.html", "/"}
<script type="text/javascript">
    $(function() {
        dr_load_cart();
    });

    function jdr_uid(obj, uid){
        var now = $(obj).prop("checked");
        if (now == true) {
            $('.jdr'+uid).prop("checked", true);
        } else {
            $('.jdr'+uid).prop("checked", false);
        }
    };
    function jdr_all(obj){
        var now = $(obj).prop("checked");
        if (now == true) {
            $('.jdcheckbox').prop("checked", true);
        } else {
            $('.jdcheckbox').prop("checked", false);
        }
    };
    function dr_load_cart() {
        $.ajax({type: "GET", url: "{dr_url('order/cart/ajax_data')}&"+Math.random(), dataType:"jsonp",
            success: function (data) {
                $("#dr_cart").html(data.html);
            }
        });
    }
    function dr_set_num(num, id) {
        $.ajax({type: "GET", url: "{dr_url('order/cart/update_num')}&id="+id+"&num="+num+"&"+Math.random(), dataType:"jsonp",
            success: function (data) {
                if (data.status) {
                    // 重新载入
                    dr_load_cart();
                } else {
                    $('#dr_update_'+id).html('<span style="color:#fff">'+data.code+'</span>');
                }
            }
        });
    }
    function dr_update_num(op, id) {
        var num = parseInt($("#dr_row_num_"+id).val());
        if (isNaN(num) || num < 1) num = 0;
        if (op) {
            // 加操作
            num++;
        } else {
            // 减操作
            num--;
            if (isNaN(num) || num < 1) num = 0;
        }
        $("#dr_row_num_"+id).val(num);
        dr_set_num(num, id);
    }
    function dr_delete_all() {
        var _data = $("#myform").serialize();
        if ((_data.split('ids')).length-1 <= 0) {
            dr_tips(lang['select_null'], 2);
            return true;
        }
        $('#dr_delete_load_all').show();
        $.ajax({type: "POST", dataType: "jsonp", url: "{dr_url('order/cart/delete_all')}&"+Math.random(), data: _data, success: function (data) {
            if (data.status) {
                // 重新载入
                dr_load_cart();
            } else {
                dr_tips(data.code);
                $('#dr_delete_load_all').hide();
            }
        }});
    }

    function dr_delete(id) {
        $('#dr_delete_load_'+id).show();
        $.ajax({type: "GET", url: "{dr_url('order/cart/delete')}&id="+id+"&"+Math.random(), dataType:"jsonp",
            success: function (data) {
                if (data.status) {
                    // 重新载入
                    dr_load_cart();
                } else {
                    dr_tips(data.code);
                    $('#dr_delete_load_'+id).hide();
                }
            }
        });
    }
</script>

<div class="page-container">
    <div class="page-content-wrapper">
        <div class="page-content bg-h">
            <div class="container">



                <ul class="page-breadcrumb breadcrumb">
                    <li>
                        <a href="{SITE_URL}">首页</a>
                        <i class="fa fa-angle-right"></i>
                    </li>
                    <li>
                        <span>我的购物车</span>
                    </li>
                </ul>

                <div class="stepBlock">
                    <h2 class="first"></h2>
                    <p class="stepTxt">
                        <span class="one selected">加入购物车</span>
                        <span class="two">确认订单内容</span>
                        <span class="three">成功提交并付款</span>
                        <span class="four">确认收货并评论</span>
                    </p>
                </div>

                <div class="book-content">
                    <div class="commonTitle clearfix">
                        <h4 class="fl fw">购物车商品</h4>
                    </div>


                </div>

                <form action="" id="myform" method="post">
                    <div class="page-content-inner" id="dr_cart">
                        <div class="cart_loading"><img src="{THEME_PATH}admin/images/loading-mini.gif" />&nbsp;数据加载中...</div>
                    </div>
                </form>


            </div>
        </div>
    </div>
</div>

{template "footer.html", "/"}